home *** CD-ROM | disk | FTP | other *** search
- unit EDSDB;
- interface
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Controls, Graphics, Forms,
- Menus, StdCtrls, ExtCtrls,DBCtrls, DBGrids;
-
- type
- TDBEnterEdit = class(TDBEdit)
- private
- { Private declarations }
- protected
- { Protected declarations }
- procedure KeyPress(var Key: Char); override;
- procedure KeyDown (var Key: Word; Shift: TShiftState); override;
- public
- { Public declarations }
- published
- { Published declarations }
- end; { TDBEnterEdit }
-
- TNewDBGrid = class (TDBGrid)
- private
- { Private declarations }
- FOnClick : TNotifyEvent;
- procedure Click; override;
- published
- { Published declarations }
- property OnClick : TNotifyEvent read FOnClick write FOnClick;
- end; { TNewDBGrid }
-
- procedure Register;
-
- implementation
-
- procedure TDBEnterEdit.KeyPress(var Key: Char);
- var
- MYForm: TForm;
- begin
- if Key = #13 then
- begin
- MYForm := GetParentForm( Self );
- if not (MYForm = nil ) then
- SendMessage(MYForm.Handle, WM_NEXTDLGCTL, 0, 0);
- Key := #0;
- end; { if... }
- if Key <> #0 then inherited KeyPress(Key);
- end; { TDBEnterEdit.KeyPress }
-
- procedure TDBEnterEdit.KeyDown (var Key: Word; Shift: TShiftState);
- var
- St: string;
- begin
- case Key of
- VK_UP: if ssCtrl in Shift then
- begin
- Text := UpperCase (Text);
- Key := 0;
- end; { if... }
- VK_DOWN: if ssCtrl in Shift then
- begin
- St := UpperCase (Text);
- St[1] := UpCase (St[1]);
- Text := St;
- Key := 0;
- end; { if... }
- end; { case }
- end; { TDBEnterEdit.KeyDown }
-
- procedure TNewDBGrid.Click;
- begin
- inherited Click;
- if assigned (FOnClick) then FOnClick (Self);
- end; { TNewDBGrid.Click }
-
- procedure Register;
- begin
- RegisterComponents('Domain', [TDBEnterEdit, TNewDBGrid]);
- end;
-
- end. { EDSDB }
-